home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / support / demodb.sh < prev    next >
Encoding:
Text File  |  1993-01-18  |  2.4 KB  |  160 lines

  1. :    "@(#)demodb.sh    8.2    1/28/86"
  2. if test "$1" = "" ; then
  3.     echo no database name specified
  4.     exit
  5. fi
  6. echo creating database $1 -- please wait
  7. if creatdb $2 $1 ; then echo loading relations ; else exit; fi
  8. ingres -s $1 << 'EOF'
  9.     create item (
  10.         number is i2,
  11.         name is c20,
  12.         dept is i2,
  13.         price is i2,
  14.         qoh is i2,
  15.         supplier is i2)
  16.  
  17.     create sale (
  18.         number is c6,
  19.         date is c8,
  20.         store is i2,
  21.         dept is i2,
  22.         item is i2,
  23.         quantity is i2,
  24.         employee is i2,
  25.         credit is c8)
  26.  
  27.     create employee (
  28.         number is i2,
  29.         name is c20,
  30.         salary is i2,
  31.         manager is i2,
  32.         birthdate is i2,
  33.         startdate is i2)
  34.  
  35.     create dept (
  36.         number is i2,
  37.         name is c20,
  38.         store is i2,
  39.         floor is i2,
  40.         manager is i2)
  41.  
  42.     create supplier (
  43.         number is i2,
  44.         name is c15,
  45.         city is c15,
  46.         state is c6)
  47.  
  48.     create store (
  49.         number is i2,
  50.         city is c15,
  51.         state is c6)
  52.  
  53.     create parts (
  54.         pnum is i2,
  55.         pname is c20,
  56.         color is c8,
  57.         weight is i2,
  58.         qoh is i2)
  59.  
  60.     create supply (
  61.         snum is i2,
  62.         pnum is i2,
  63.         jnum is i2,
  64.         shipdate is c8,
  65.         quan is i2)
  66.  
  67.  
  68.     copy item (number is c6,
  69.         name is c20,
  70.         dept is c6,
  71.         price is c6,
  72.         qoh is c6,
  73.         supplier is c6)
  74.     from "{pathname}/demo/item"
  75.  
  76.     copy sale (
  77.         number is c6,
  78.         date is c8,
  79.         store is c6,
  80.         dept is c6,
  81.         item is c6,
  82.         quantity is c6,
  83.         employee is c6,
  84.         credit is c8)
  85.     from "{pathname}/demo/sale"
  86.  
  87.     copy employee (
  88.         number is c6,
  89.         name is c20,
  90.         salary is c6,
  91.         manager is c6,
  92.         birthdate is c6,
  93.         startdate is c6)
  94.     from "{pathname}/demo/employee"
  95.  
  96.     copy dept (
  97.         number is c6,
  98.         name is c20,
  99.         store is c6,
  100.         floor is c6,
  101.         manager is c6)
  102.     from "{pathname}/demo/dept"
  103.  
  104.     copy supplier (
  105.         number is c6,
  106.         name is c15,
  107.         city is c15,
  108.         state is c6)
  109.     from "{pathname}/demo/supplier"
  110.  
  111.     copy store (
  112.         number is c6,
  113.         city is c15,
  114.         state is c6)
  115.     from "{pathname}/demo/store"
  116.  
  117.     copy parts (
  118.         pnum is c6,
  119.         pname is c20,
  120.         color is c8,
  121.         weight is c6,
  122.         qoh is c6)
  123.     from "{pathname}/demo/parts"
  124.  
  125.     copy supply (
  126.         snum is c6,
  127.         pnum is c6,
  128.         jnum is c6,
  129.         shipdate is c8,
  130.         quan is c6)
  131.     from "{pathname}/demo/supply"
  132.  
  133.     range of i is item
  134.     define permit all on i to all
  135.  
  136.     range of s is sale
  137.     define permit all on s to all
  138.  
  139.     range of e is employee
  140.     define permit all on e to all
  141.  
  142.     range of d is dept
  143.     define permit all on d to all
  144.  
  145.     range of s is supplier
  146.     define permit all on s to all
  147.  
  148.     range of s is store
  149.     define permit all on s to all
  150.  
  151.     range of p is parts
  152.     define permit all on p to all
  153.  
  154.     range of s is supply
  155.     define permit all on s to all
  156.     \g
  157.     \q
  158. EOF
  159. echo database $1 created
  160.